//
//  CanvasViewController.h
//  Composite
//
//  Created by Carlo Chung on 9/11/10.
//  Copyright 2010 Carlo Chung. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "Scribble.h"
#import "CanvasView.h"
#import "CanvasViewGenerator.h"
#import "CommandBarButton.h"
#import "NSMutableArray+Stack.h"

@class CanvasViewController;    
@protocol CanvasViewControllerDeleate <NSObject>

-(void) canvasView: (CanvasViewController*) canvasView saveImage:(UIImage*)image;

@end
@interface CanvasViewController : UIViewController
{
  @private
  Scribble *scribble_;
  CanvasView *canvasView_;
  
  CGPoint startPoint_;
  UIColor *strokeColor_;
  CGFloat strokeSize_;
}

@property (nonatomic, retain) CanvasView *canvasView;
@property (nonatomic, retain) Scribble *scribble;
@property (nonatomic, retain) UIColor *strokeColor;
@property (nonatomic, assign) CGFloat strokeSize;
@property (nonatomic, readonly) UIImage *picture;
@property(nonatomic, retain) id<CanvasViewControllerDeleate> delegate;
- (void) loadCanvasViewWithGenerator:(CanvasViewGenerator *)generator;
- (void) setInputData:(UIImage*) image;

- (IBAction) onBarButtonHit:(id) button;
- (IBAction) onCustomBarButtonHit:(CommandBarButton *)barButton;
-(IBAction) onSaveBarButtonHit:(id) sender;

- (NSInvocation *) drawScribbleInvocation;
- (NSInvocation *) undrawScribbleInvocation;

-(IBAction) backToEditImageView;
- (void) executeInvocation:(NSInvocation *)invocation withUndoInvocation:(NSInvocation *)undoInvocation;
- (void) unexecuteInvocation:(NSInvocation *)invocation withRedoInvocation:(NSInvocation *)redoInvocation;

@end

